﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>校友注册</title>
    <link rel="stylesheet" type="text/css" href="/ViewMob/css/default.css">
    <link href="/ViewMob/css/reset.css" rel="stylesheet" type="text/css">
    <link href="/ViewMob/js/layer/need/layer.css" rel="stylesheet" />
    <script src="/ViewMob/js/layer/layer.m.js"></script>
    <script src="/ViewMob/js/zepto.min.js"></script>
    <script src="/ViewMob/js/avalon.mobile.js"></script>
    <script src="/ViewMob/js/ComFunJS.js"></script>
    <script src="/ViewMob/js/zepto.md5.js"></script>
    <style>
        select {
            border: none;
            width: 100%;
            font-size: 1.5rem;
            height: 100%;
            background-color: #efefb4;
            padding-left: .5REM;
        }

        input {
            border: none;
            width: 100%;
            font-size: 1.5rem;
            height: 100%;
            background-color: #efefb4 !important;
            padding-left: .5REM;
        }

        body {
            background: url(../images/teacher.gif);
            background-repeat: no-repeat;
            background-size: 100% 100%;
            background-attachment: fixed;
            background-position: top left;
            overflow: hidden;
        }
    </style>
    <script>
        var model = avalon.define({
            $id: "Register",
            njdata: [],
            gwdata: [],
            pagecode: 0,
            modelData: { "TeacherName": "", "Phone": "", "Pasword": "", "usertype": 0 },
            dxyzm: "",
            xydata: [],
            Next: function () {
                $.getJSON("/API/VIEWAPI.ashx?Action=Commanage_XYYZSJ&r=" + Math.random(), { P1: $("#rxnf").val(), P2: $("#zsxm").val(), txxm: $("#txxm").val() }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.xydata = resultData.Result.mytable;
                        if (model.xydata.length == 0) {
                            alert('没有找到有效的校友信息!')
                        } else {
                            model.pagecode = 1;
                        }
                    }
                });
            },
            SaveForm: function (dom) {
                var msg = "";
                if ($.trim($("#name").val()) == "") {
                    msg = "请输入手机号";
                }
                if (!$("#name").val() || !(/^1[3|4|5|8|7][0-9]\d{8}$/).test($("#name").val())) {

                    msg = "请输入正确的手机号";
                }
                if ($.trim($("#dlmm").val()) == "") {
                    msg = "请输入密码";

                }
                if (msg) {
                    ComFunJS.winwarning(msg);
                    return;
                }
                $.getJSON("/API/VIEWAPI.ashx?Action=Commanage_XYZC&r=" + Math.random(), { P1: $("#dqxy").val(), P2: $("#name").val(), PSD: $("#dlmm").val(), dwlb: $("#dwlb").val(), dwmc: $("#dwmc").val(), gwlb: $("#gwlb").val(), zwmc: $("#zwmc").val() }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.nouser = resultData.Result;
                        ComFunJS.winconfirm("注册成功!账号" + $("#name").val() + "密码" + $("#dlmm").val(), function () {
                            location.href = "UI_Login.html";
                        }, function () {
                            ComFunJS.closeAll()
                        })
                    }
                });
            }
        })

        avalon.ready(function () {
            $.getJSON("/API/VIEWAPI.ashx?Action=Commanage_GETNJANDYX&r=" + Math.random(), { P1: "" }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    model.njdata = resultData.Result;
                }
            });
            $.getJSON("/API/VIEWAPI.ashx?Action=Commanage_GETGWDATA&r=" + Math.random(), { P1: "" }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    model.gwdata = resultData.Result;
                }
            });
        })
    </script>
</head>
<body style="display: table; width: 100%" ms-controller="Register">
    <div class="form-box">
           <div class="logo-teacher tc" style="font-size: 40px; color: #1C8DF4">
            无锡职业技术学院
        </div>
        <div class="logo-teacher tc" style="font-size: 16px;">
            校友管理系统
        </div>
        <div ms-if="pagecode==0">
            <div class="input-panel" style="margin-top: 20px;">
                <select id="rxnf">
                    <option value="">入学年份</option>
                    <option ms-attr-value="{{el.nj}}" ms-repeat-el="njdata">{{el.nj}}</option>
                </select>
            </div>
            <div class="input-panel">
                <input type="text" placeholder="真实姓名" id="zsxm" style="color: black">
            </div>
            <div class="input-panel">
                <input type="text" placeholder="输入一个同班同学姓名" id="txxm" style="color: black">
            </div>
            <div class="input-panel-btn">
                <button ms-click="Next(this)">
                    下一步 
                </button>
                <div class="login-zc">已有账号？<a href="UI_Login.html">去登陆</a></div>
            </div>
        </div>
        <div ms-if="pagecode==1">
            <div class="input-panel" style="margin-top: 20px;">
                <select id="dqxy">
                    <option ms-repeat-el="xydata" ms-attr-value="{{el.xh}}">{{el.xm}}{{el.xh}}</option>
                </select>
            </div>
            <div class="input-panel">
                <input type="text" placeholder="手机号" style="color: black" id="name">
            </div>
            <div class="input-panel">
                <input type="password" placeholder="密码" style="color: black" id="dlmm">
            </div>
            <div class="input-panel" style="margin-top: 20px;">
                <select id="dwlb">
                    <option value="">请选择单位类别</option>
                    <option>政府单位</option>
                    <option>事业单位</option>
                    <option>跨国企业</option>
                    <option>国企</option>
                    <option>大型民营企业</option>
                    <option>中小型民营企业</option>
                    <option>其它</option>
                </select>
            </div>
            <div class="input-panel">
                <input type="text" placeholder="单位名称" style="color: black" id="dwmc">
            </div>
            <div class="input-panel" style="margin-top: 20px;" >
                <select id="gwlb">
                    <option value="">请选择岗位类别</option>
                    <option ms-repeat-el="gwdata" ms-attr-value="{{el.ID}}">{{el.gwlb}}</option>
                </select>
            </div>
            <div class="input-panel">
                <input type="text" placeholder="职位" style="color: black" id="zwmc">
            </div>
            <div class="input-panel-btn">
                <button ms-click="SaveForm(this)">
                    注册 
                </button>
                <div class="login-zc">已有账号？<a href="UI_Login.html" external>去登陆</a></div>
            </div>
        </div>


    </div>
</body>
</html>
